﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using TYBase;

namespace TYBase {
    public static class DirectoryHelper {
        public static object obj_check = new object();
        public static bool CheckDirectory(string saveFileDirectory) {
            try {
                if (saveFileDirectory.Null())
                    return false;
                lock (obj_check) {
                    if (Directory.Exists(saveFileDirectory)) {
                        return true;
                    }
                    Directory.CreateDirectory(saveFileDirectory);
                    if (Directory.Exists(saveFileDirectory)) {
                        return true;
                    }
                    return false;
                }
            }
            catch (Exception ex) {
                Log.E(ex, $"CheckDirectory {saveFileDirectory}");
                return false;
            }
        }

    }
}
